<template>
  <div class="build_Nav">
    <div class="house_type" v-if="titleType === 1">
      <div>
        <img v-if="userData" :src="userData.photo" alt="">
      </div>
      <div>
        <div>{{userData.name}}</div>
        <div class="company-name">{{userData.company_id | dropStr(8)}}</div>
      </div>
    </div>
    <div class="build_type" v-if="titleType === 2">
      <div>免费咨询售楼处</div>
      <div>{{phoneNumber}}</div>
    </div>
    <div @click="goPhone">
      <span class="iconfont icon-dianhua"></span>
      <span>电话</span>
    </div>
    <div @click="goLookHouse">
      预约看房
    </div>
  </div>
</template>

<script>
import {setLookType} from '../../assets/js/cache';

export default {
    props: {
      phoneNumber: {
        type: String,
        default: '18888888888'
      },
      titleType: {
        type: Number,
        default: 2
      },
      userData:{
        type:Object,
        // default: {}
      }
    },
    name: 'BuildNav',
    methods: {
      goPhone() {
        window.location.href = 'tel://' + this.phoneNumber;
      },
      goLookHouse(){
         setLookType(this.titleType);
         this.$router.push('/LookHouseBuild/' + this.$route.params.id);
      }
    }
  }
</script>

<style scoped>
  .build_Nav {
    display: flex;
    /*justify-content: space-between;*/
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
  }

  .build_Nav > div {
    padding: 10px;
    font-size: 0.8rem;
    height: 30px;
    line-height: 30px;
  }

  .build_Nav .build_type {
    /*width: 40%;*/
    flex: 1;
    color: #ffffff;
    background: #313131;
    line-height: 20px;
  }

  .build_Nav  .house_type {
    /*width: 40%;*/
    flex: 1;
    /*max-width: 50%;*/
    background-color: #ffffff;
    line-height: 20px;
    color: #666666;
    display: flex;
    padding: 5px 10px;
    height: 100%;
  }
  .build_Nav  .house_type .company-name{

}
  .build_Nav .house_type > div:nth-child(1) {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
  }
  .build_Nav .house_type > div:nth-child(2)>div:nth-child(2){
    color: #999999;
    font-size: 0.4rem;
  }
  .build_Nav .house_type >div >div{
    white-space:nowrap;
    /*overflow: hidden;*/
  }
  .build_Nav .house_type img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }

  .build_Nav > div:nth-child(2) {
    width: 20%;
    background: #FD7B01;
    color: #ffffff;
    text-align: center;
  }

  .build_Nav > div:nth-child(3) {
    flex: 1;
    background: #e6191e;
    color: #ffffff;
    text-align: center;
  }

</style>
